package com.cq.hd.member.service;

import com.cq.hd.common.pagination.Page;
import com.cq.hd.member.api.dto.*;
import com.cq.hd.member.api.vo.*;
import com.cq.hd.member.po.TbBusinessAgentPo;
import com.baomidou.mybatisplus.extension.service.IService;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 商家经纪人关联表 服务类
 * </p>
 *
 * @author mYunYu
 * @since 2023-11-21
 */
public interface TbBusinessAgentService extends IService<TbBusinessAgentPo> {

    Page<AgentPageVo> pageAgent(AgentPageDto agentPageDto);

    List<BusinessAgentVo> listByBusinessIds(List<Long> businessIds);

    Boolean unBind(BusinessAgentUnBindDto businessAgentUnBindDto);

    BusinessAgentIndexVo businessAgentIndex(BusinessAgentIndexDto businessAgentIndexDto);

    Page<MyAgentPageVo> pageMyAgent(MyAgentPageDto myAgentPageDto);

    Page<MyBusinessPageVo> pageMyBusiness(MyBusinessPageDto myBusinessPageDto);

    Boolean saveAgentCommission(BusinessAgentCommissionSaveDto businessAgentCommissionSaveDto);

    Page<BusinessAgentCommissionPageVo> pageAgentCommission(BusinessAgentCommissionPageDto businessAgentCommissionPageDto);

    Page<BusinessGroupAgentPageVo> pageBusinessGroupAgent(BusinessGroupAgentPageDto businessGroupAgentPageDto);

    Boolean deleteBusinessGroupAgent(Long id, Long userId, Long businessId);

    BusinessAgentVo getBusinessAgentById(Long businessId, Long userId);

    List<BusinessSelectAgentGroupVo> listBusinessSelectAgent(Long userId, Long businessId);

    List<BusinessAgentVo> listByDto(BusinessAgentDto businessAgentDto);

    Integer getNewCountByDate(String startTime, String endTime);

    Boolean updateBusinessAgentOrder(UpdateBusinessAgentOrderDto updateBusinessAgentOrderDto);

    Boolean updateSubAgentOrder(UpdateSubAgentOrderDto updateSubAgentOrderDto);

    // 批量删除分组成员，批量移动分组成员
    Boolean batchChangeGroup(BusinessGroupBatchChangeGroupDto businessGroupBatchChangeGroupDto);

    // 上级经纪人
    MyAgentVo myParentAgent(Long userId);

    // 我的策划人id集合
    List<Long> myBusinessIds(Long userId);

    // 获取一级经纪人给二级经纪人的佣金比例
    BigDecimal getSubAgentCommissionRate(Long userId, Long agentId);

    // 获取商家给一级经纪人的佣金比例
    BigDecimal getAgentCommissionRate(Long userId, Long businessId);

    // 批量获取商家跟指定经纪人的佣金比例
    Map<Long, BigDecimal> getAgentCommissionRateByBusinessIds(Long userId, List<Long> businessIds);
}
